package com.foreknow.elm.service.impl;

import com.foreknow.elm.dao.FoodDao;
import com.foreknow.elm.dao.impl.FoodDaoImpl;
import com.foreknow.elm.po.Food;
import com.foreknow.elm.service.FoodService;
import com.foreknow.elm.util.DBUtil;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

public class FoodServiceImpl implements FoodService {
    @Override
    public List<Food> slist(Integer businessId) {
        Connection conn = DBUtil.getConnection();
        FoodDao foodDao = new FoodDaoImpl();
        try {
            List<Food> list = foodDao.list(businessId);
            return list;
        } catch (SQLException e) {
            e.printStackTrace();
        }finally {
            try {
                conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
}
